Skip to content

Stop escalating dataset delete to dataset destroy - #12639

Open
qqmyers wants to merge 17 commits into
IQSS:developfrom
GlobalDataverseCommunityConsortium:11253.v2-inconsistent-dataset-delete-api
Open

Stop escalating dataset delete to dataset destroy#12639
qqmyers wants to merge 17 commits into
IQSS:developfrom
GlobalDataverseCommunityConsortium:11253.v2-inconsistent-dataset-delete-api

Conversation

@qqmyers

@qqmyers qqmyers commented Aug 24, 2026

Copy link
Copy Markdown
Member

What this PR does / why we need it: This PR builds on #12332 to close issue #11253, removing the superuser override in the Delete Unpublished Dataset API (which allowed it to work as the Delete Published Dataset API). However, unlike the original, it keeps the restriction that Delete Unpublished Dataset only works on unpublished datasets (those that have only a draft version). The docs are updated to note this restriction and that the Delete Dataset Draft API, which deletes the draft version of any dataset, is the equivalent of Delete Unpublished Dataset when the draft is the only version.

Which issue(s) this PR closes:

Special notes for your reviewer: The error code is changed from UNAUTHORIZED (which probably should have been FORBIDDEN) to 400/BAD_REQUEST when the api is called on a published dataset.

Suggestions on how to test this: Verify that the Delete Unpublished Dataset call works when only a draft exists and that it responds with a 400 error if the dataset is published (has only published versions or if v1 exists and a draft.)

Does this PR introduce a user interface change? If mockups are available, please link/include them here:

Is there a release notes update needed for this change?: included

Additional documentation:

@qqmyers qqmyers added the Size: 3 A percentage of a sprint. 2.1 hours. label Aug 24, 2026
@qqmyers qqmyers added this to the 6.12 milestone Aug 24, 2026
Comment thread doc/sphinx-guides/source/api/changelog.rst Outdated
Co-authored-by: Philip Durbin <philip_durbin@harvard.edu>
@pdurbin pdurbin moved this from Ready for Triage to In Review 🔎 in IQSS Dataverse Project Aug 25, 2026
vera
vera previously requested changes Aug 25, 2026

@vera vera left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

Fixes the original issue #11253 by always restricting the "delete unpublished dataset" API to unpublished datasets (which only have a draft version and nothing else), even if called by a superuser. The restriction to unpublished datasets also keeps the API distinct from the more general "delete dataset draft" API, so there's not two duplicate APIs.

I just left a few minor textual suggestions.

Comment thread doc/release-notes/11253-inconsistent-dataset-delete-api.md Outdated
Comment thread src/main/java/edu/harvard/iq/dataverse/api/Datasets.java Outdated
Comment thread src/main/java/edu/harvard/iq/dataverse/api/Datasets.java Outdated
qqmyers and others added 3 commits August 25, 2026 12:43
Co-authored-by: Vera Clemens <16904069+vera@users.noreply.github.com>
@cmbz cmbz added FY27 Sprint 4 FY27 Sprint 4 (2026-08-12 - 2026-08-26) FY27 Sprint 5 FY27 Sprint 5 (2026-08-26 - 2026-09-09) labels Aug 26, 2026
Conflicts:
doc/sphinx-guides/source/api/changelog.rst
@pdurbin
pdurbin dismissed vera’s stale review September 2, 2026 19:59

As discussed at standup today, Jim already made the doc changes Vera requested. Dismissing.

@pdurbin pdurbin assigned pdurbin and unassigned vera Sep 2, 2026

@pdurbin pdurbin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found a couple places where tests are failing.

I'm also wordsmithing a bit. 😅

deleteDatasetResponse.prettyPrint();
deleteDatasetResponse.then().assertThat()
.body("message", containsString("unpublished"))
.statusCode(FORBIDDEN.getStatusCode());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is failing:

[ERROR]   DatasetsIT.testCreateDataset:354 1 expectation failed.
Expected status code <403> but was <400>.

deleteDatasetResponse.prettyPrint();
deleteDatasetResponse.then().assertThat()
.body("message", containsString("/destroy"))
.statusCode(FORBIDDEN.getStatusCode());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fail:

[ERROR]   DatasetsIT.testCreateDataset:361 1 expectation failed.
Expected status code <403> but was <400>.

Comment thread src/main/java/edu/harvard/iq/dataverse/api/Datasets.java Outdated
qqmyers and others added 2 commits September 2, 2026 18:19
Co-authored-by: Philip Durbin <philipdurbin@gmail.com>

@pdurbin pdurbin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@github-project-automation github-project-automation Bot moved this from In Review 🔎 to Ready for QA ⏩ in IQSS Dataverse Project Sep 3, 2026
@pdurbin pdurbin changed the title 11253.v2 inconsistent dataset delete api Stop escalating dataset delete to dataset destroy Sep 3, 2026
@pdurbin pdurbin modified the milestones: 6.12, 6.13 Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FY27 Sprint 4 FY27 Sprint 4 (2026-08-12 - 2026-08-26) FY27 Sprint 5 FY27 Sprint 5 (2026-08-26 - 2026-09-09) Size: 3 A percentage of a sprint. 2.1 hours.

Projects

Status: Ready for QA ⏩

Development

Successfully merging this pull request may close these issues.

Inconsistent behaviour of dataset delete API

5 participants